﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text.RegularExpressions;

namespace Eacademy.Library.Validations
{
    public static class ValidationExtensions
    {

        public static bool IsValidEmail(this object value)
        {
            var str = (string)value;
            if (string.IsNullOrEmpty(str))
                return true;

            return new Regex(@"^[\w-\.]{1,}\@([\w]{1,}\.){1,}[a-z]{2,4}$", RegexOptions.IgnoreCase).IsMatch(str);
        }
    }
}